﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hydrogen.MathExt.Expression.Functions
{
    internal class FunctionSqrt : FunctionBase
    {
        public override double Evaluate(params double[] args)
        {
            var v = GetArg(args);
            if(v <= 0)
            {
                throw new ArgumentException($"不能对小于等于0的数值开根号:{v}");
            }
            return System.Math.Sqrt(v);
        }
    }
}
